<?php

namespace mpend\controllers;

use Yii;
use mpend\components\Controller;
use common\exceptions\ModelHttpException;
use mpend\models\DeviceForm;

/**
 * Site controller
 * Descriptions
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 * @date date time
 */
class TestController extends Controller {

    public $closeCheckAuthent = true;

    /**
     * Declares the allowed HTTP verbs.
     * Please refer to [[VerbFilter::actions]] on how to declare the allowed verbs.
     * @return array the allowed HTTP verbs.
     */
    protected function verbs() {
        return [
            '*' => ['GET'],
            'list' => ['GET', 'POST'],
            'debug' => ['POST'],
        ];
    }

    /**
     * Displays homepage.
     * @return mixed
     */
    public function actionIndex() {
        $excel = new \common\components\office\Excel();
        $excel->export();
        return '鲁能体育开放平台';
    }

    /**
     * 获取当前应用版本信息
     * @return mixed
     */
    public function actionList() {
        $model = new \mpend\models\test\MatchSearch();
        $model->load(Yii::$app->request->getQueryParams(), '');
        return $model->search();
    }

    /**
     * 获取当前应用版本信息
     * @return mixed
     */
    public function actionDebug() {
        $workbookId = Yii::$app->request->post('workbook_id');
        return [
            'title' => 'workbook:' . $workbookId,
            'path' => '/pages/share/main?id=' . $workbookId,
            'imageUrl' => 'https://oss.youmbe.com/assets/share/foreman.jpg',
        ];
    }

}
